package week4;

public class Student {
    private String firstname, lastname;
    private Address homeAddress, schoolAdderss;
    private float testScore1 = 0, testScore2 = 0, testScore3 = 0, averageScore, Score;

    //---------------------------------------------------------------
    // Constructor: Sets up this student with the specified values.
    //---------------------------------------------------------------
    public Student(String first, String last, Address home, Address school, float score1, float score2, float score3){
        firstname = first;
        lastname = last;
        homeAddress = home;
        schoolAdderss = school;
        testScore1 = score1;
        testScore2 = score2;
        testScore3 = score3;
    }

    public void setTestScore(int test, float score){
        if (test < 2)
            testScore1 = score;
        else if (test < 3 && test > 1)
            testScore2 = score;
        else if (test < 4 && test > 2)
            testScore3 = score;
    }

    public float getTestScore(int testNum){
        switch (testNum) {
            case 1:
                Score = testScore1;
            case 2:
                Score = testScore2;
            case 3:
                Score = testScore3;
        }
        return Score;
    }

    public float average(){
        averageScore = (testScore1 + testScore2 + testScore3) / 3;

        return averageScore;
    }

    //---------------------------------------------------------------
    // Return a string description of this Address object.
    //---------------------------------------------------------------
    @Override
    public String toString() {
        String result;

        result = firstname + " " + lastname + "\n";
        result += "Home Address:\n" + homeAddress + "\n";
        result += "School Address:\n" + schoolAdderss + "\n";
        result += "TestScore: \n" + testScore1 + "\t" + testScore2 + "\t" +testScore3 + "\n";
        result += "Average Score: \n" + (testScore1 + testScore2 + testScore3) / 3 + "\n";

        return result;
    }
}
